<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

class AppController extends Controller {

    var $components = array('Auth');

    function beforeFilter() {
        //set default layout
        //overwrite params from url
        if($this->params['form']){
             if(array_key_exists('task', $this->params['form']) ){
                 $this->params['action']  =   $this->params['form']['task'];
             }
        }

        $this->layout = 'default';
        $this->Auth->authenticate = ClassRegistry::init('User');
        $this->Auth->flashElement = 'error';
        $this->Auth->loginRedirect = array('controller' => 'default');
        $this->Auth->loginAction = array('admin' => false, 'controller' => 'users', 'action' => 'login');
        $this->set('baseUrl', Configure::read('baseUrl'));
        
        $this->set('site_name', Configure::read('site_name'));

    }

}

?>
